using System;
using Mono.Fuse;
using Mono.Unix.Native;
using System.Collections;
using System.Collections.Generic;
using System.Threading;

namespace Mehat.San.SanFS
{
	public enum EFileHandleState
	{
		Disconnected,
		Connected
	}
	
	public class FileHandle
	{
		private long				mIdentifier;
		private IFile				mFile;
		private int					mExternalFd = -1;
		private OpenedPathInfo		mInfo;
		private EFileHandleState	mState = EFileHandleState.Disconnected;
		
		public FileHandle(IFile File, OpenedPathInfo Info, long Identifier)
		{
			mFile = File;
			mIdentifier = Identifier;
			mInfo = Info;
		}
		
		public long Identifier
		{
			get { return mIdentifier; }
		}
		
		public IFile File
		{
			get { return mFile; }
		}
		
		public int ExternalFd
		{
			get { return mExternalFd; }
			set
			{
				if (value == -1)
					mState = EFileHandleState.Disconnected;
				else
					mState = EFileHandleState.Connected;
			}
		}
		
		public OpenedPathInfo OpenInfo
		{
			get { return mInfo; }
		}
		
		public EFileHandleState State
		{
			get { return mState; }
		}
	}  // END CLASS
}  // END NAMESPACE
